package cn.cutie.clotconfig.client.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: Cutie
 * @CreateDate: 2024/5/10 22:26
 * @Version: 0.0.1
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ConfigMeta {
    String app;
    String env;
    String ns;
    String configServer;

    public String genKey(){
        return this.getApp() + ":" + this.getEnv() + ":" + this.getNs();
    }

    public String listPath(){
        return this.path("list");
    }
    public String versionPath(){
        return this.path("version");
    }

    private String path(String path){
        return this.getConfigServer()
                + "/"+ path +"?app=" + this.getApp() + "&env=" + this.getEnv() + "&ns=" + this.getNs();
    }
}
